package Day12;

import java.util.Scanner;

public class Text1 {
    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) throws  BadException,UsernameException{
        System.out.println("请输入用户名");
        String name = sc.nextLine();
        System.out.println("请输入密码");
        String password = sc.next();
        login(name,password);
    }


    public static void login(String name, String passowrd)throws BadException,UsernameException{
        if("amdin".equals(name)){
            if ("123456".equals(passowrd)) {
                System.out.println("登录成功");
            }else{
                throw new BadException("密码输入错误");
            }
        }else{
            throw new UsernameException("用户名输入错误");
        }
    }
}
